import { Application } from 'egg';

export default (app: Application) => {
  class Controller extends app.Controller {
    async disconnect() {
      console.log('disconnect');
      const message = this.ctx.args[0];
      console.log(message);
    }

    async chat() {
      console.log('chat............');
      const message = this.ctx.args[0];
      await this.ctx.socket.emit('res', `Hi! I've got your message: ${message}`);
    }
  }
  return Controller;
};
